
package superproyecto;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author 18735026-3 
 */
public class Conectate {

   static String bd = "superproyecto"; 
   static String login = "superusuario"; 
   static String password = "hola123"; 
   static String url = "jdbc:mysql://db4free.net:3306/"+bd; 
 
   Connection conn = null; 
    
   public Conectate() { 
      try{          
         Class.forName("com.mysql.jdbc.Driver");          
         conn = DriverManager.getConnection(url,login,password); 
         if (conn!=null){ 
            System.out.println("Conección a base de datos "+bd+". listo"); 
         }
         else
             System.out.println("Coneccion fallida a "+bd+":");
      }catch(SQLException e){ 
         System.out.println(e); 
      }catch(ClassNotFoundException e){ 
         System.out.println(e); 
      } 
   } 
    
   public Connection getConnection(){ 
      return conn; 
   } 
 
   public void desconectar(){ 
      conn = null; 
   } 
}


